<?php

namespace Modules\Web\Http\Controllers;


use Illuminate\Http\Request;
use Modules\Web\Service\ActivityService;

class ActivityController extends BaseController
{

    /**
     *  获取当前商户的活动列表
     *  hinq 2019 10 30
     *
     **/
    public function list( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = ActivityService::get_list( (array) $arr_input );
        return response_json( $arr_list );
    }

	/**
	 *	添加活动数据
	 *	hinq 2019 10 29 
	 *
	 **/
	public function store(Request $request){
		$arr_input = (array) $request->all();
		return ActivityService::add_one( (array) $arr_input );
	}
    

    /**
     *  获取当前商户添加的所有商品
     *  hinq 2019 10 30
     *
     **/
    public function get_shops_list(Request $request){
        $arr_input = (array)$request->all();
        $arr_list = ActivityService::get_goods_page( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  添加活动的商品
     *  hinq 2019 10 30
     *
     ***/
    public function activity_goods_store(Request $request){
        $arr_input = (array) $request->all();
        $arr_list = ActivityService::activity_goods_store( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  获取指定活动、指定模块下已添加的商品列表
     *  hinq 2019 10 30
     *
     **/
    public function activity_goods_module( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = ActivityService::activity_goods_module( (array) $arr_input );
        return response_json( $arr_list );
    }

    /**
     *  删除指定的活动
     *  hinq 2019 10 30
     *
     **/
    public function delete( Request $request ){
        $nId = (int) $request->get('id');
        $arr_list = ActivityService::delete( (int) $nId );
        return response_json( $arr_list );
    }


    /**
     *  获取指定的活动信息
     *  hinq 2019 10 31
     *
     **/
    public function activity_detail(  Request $request  ){
        $nId = (int) $request->get('id');
        $arr_list = ActivityService::get_activity_detail( (int) $nId );
        return response_json( $arr_list );
    }


    /**
     *  编辑活动信息
     *  hinq 2019 10 31
     *
     **/
    public function activity_update( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = ActivityService::activity_update( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  获取指定活动的模块列表信息
     *  hinq 2019 11 18
     *
     **/
    public function activity_module( Request $request ){
        $nId = (int) $request->get('activity_id');
        $arr_list = ActivityService::activity_module( (int) $nId );
        return response_json( $arr_list );
    }

    /**
     *  定时推送活动
     *  hinq 2020 5 12
     *
     **/
    public function timing_push_user( Request $request ){
        $arr_input = (array) $request->all();
        return ActivityService::timing_push_user( (array) $arr_input );
    }

    /**
     *  推送活动给用户
     *  hinq 2019 12 03
     *
     **/
    public function push_user( Request $request ){
        $nId = $request->get('id');
        return ActivityService::push_user( (int) $nId );
    }


    /**
     *  取消推送活动给用户
     *  hinq 2020 5 12
     *
     **/
    public function del_push_user( Request $request ){
        $nId = $request->get('id');
        return ActivityService::del_push_user( (int) $nId );
    }


}



